package com.example.demo.mapper;

import com.example.demo.pojo.dto.AdminPageDTO;
import com.example.demo.pojo.entity.Admin;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface AdminMapper {
    @Select("select * from admin where username=#{username}")
    Admin getByUsername(String username);

    @Insert("insert into admin (username, password, name, phone, create_time) VALUES " +
            "(#{username},#{password},#{name},#{phone},#{createTime})")
    void insert(Admin admin);

    Page<Admin> list(AdminPageDTO adminPageDTO);

    @Delete("delete from admin where id=#{id}")
    void deleteById(Long id);
}
